{%- import "shuup/front/macros/general.jinja" as macros with context -%}
{%- from "shuup/front/macros/add_to_cart.jinja" import add_product_to_cart -%}
{%- import "shuup/front/macros/basket.jinja" as basket_macros with context -%}
{%- import "shuup/front/macros/category.jinja" as category_macros with context -%}
{%- import "shuup/front/macros/checkout.jinja" as checkout_macros with context -%}
{%- from "shuup/front/macros/footer.jinja" import render_footer with context %}
{%- from "shuup/front/macros/navigation.jinja" import render_navigation with context %}
{%- import "shuup/front/macros/order.jinja" as order_macros with context -%}
{%- import "shuup/front/macros/product.jinja" as product_macros with context -%}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    {% block extrameta %}{% endblock %}
    {# Page Title #}
    <title>{{ request.shop.public_name }} &ndash; {% block title %}{% endblock %}</title>
    {# Include Favicon #}
    {%- set favicon = request.shop.favicon.url if request.shop.favicon else static("shuup/front/img/favicon.ico") -%}
    <link rel="icon" type="image/x-icon" href="{{ favicon }}">

    {# Include Fonts #}
    {# Include Styles #}
    {% if xtheme.get("stylesheet") %}
        <link rel="stylesheet" href="{{ shuup_static(xtheme.get('stylesheet')) }}">
    {% else %}
        <link rel="stylesheet" href="{{ shuup_static("shuup/front/css/style.css") }}">
    {% endif %}
    {% set conf = shuup.general.get_config() %}
    <script>var ShuupFrontConfig = {{ conf|json }};</script>
    {% if shuup.general.is_shop_admin() %}
        <script type="text/javascript" src="{{ url("shuup_admin:js-catalog") }}?lang={{ LANGUAGE_CODE }}&v={{ get_shuup_version() }}"></script>
    {% endif %}
    <script type="text/javascript" src="{{ url("shuup:js-catalog") }}?lang={{ LANGUAGE_CODE }}&v={{ get_shuup_version() }}"></script>
</head>
<body {% if shuup.general.is_shop_admin() %} class="admin-tools-visible" {% endif %}>
    {{ macros.render_admin_tools() }}
    <nav class="main-nav">
    {% block navigation %}
        {{ render_navigation() }}
    {% endblock %}
    </nav>
    <main class="main-container" role="main">
        <div class="container">
            {% block breadcrumb %}{% endblock %}

            {# Render messages and errors #}
            {{ macros.render_messages() }}
            {{ macros.render_errors() }}

            {# Render main content #}
            {% block before_content_title %}{% endblock %}
            {% if self.content_title() %}
                <h1 class="page-header">{% block content_title %}{% endblock %}</h1>
            {% endif %}
            <div class="page-content">
                {% block content %}{% endblock %}
            </div>
        </div>
    </main>
    {{ render_footer() }}

    {# Include JavaScript libraries #}
    <script src="{{ shuup_static("shuup/front/js/vendor.js") }}"></script>
    <script src="{{ shuup_static("shuup/front/js/scripts.js") }}"></script>
    {# Include all Extra JavaScript #}
    {% block extrajs %}{% endblock %}
    {# Enable adding products to basket with ajax #}
    {{ add_product_to_cart() }}
</body>
</html>
